﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>监控型信息化质量溯源系统</title>
    <meta name="keywords" content="成武金石食生产追溯系统" />
    <meta name="description" content="hcrain" />
    <meta name="Author" content="larry" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="Bookmark" href="hcrain.ico">
    <link rel="Shortcut Icon" href="hcrain.ico" />
    <!-- load css -->
    <link rel="stylesheet" type="text/css" href="lib/layui/css/layui.css" media="all">
    <link rel="stylesheet" type="text/css" href="css/hcrainlogin.css" media="all">
</head>
<body>
    <script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
    <script src="hcjsui/Scripts/jquery.form.js" type="text/javascript"></script>
    <script src="hcjsui/js/_Define.js" type="text/javascript"></script>
    <script type="text/javascript" src="js/hcui.js"></script>

    <div class="larry-canvas" id="canvas"></div>
    <div class="layui-layout layui-layout-login">
        <h1>
            <strong>监控型信息化质量溯源系统</strong>
            <em>安全 高效</em>
        </h1>
        <form id="loginformpost" class="form form-horizontal" action="ashx/user_loginout.ashx?action=login" method="post">
            <div class="layui-user-icon larry-login">
                <input type="text" placeholder="账号" id="lusername" name="lusername" value="admin" class="login_txtbx" />
            </div>
            <div class="layui-pwd-icon larry-login">
                <input type="password" placeholder="密码" id="luserpass" name="luserpass" value="admin" class="login_txtbx" />
            </div>
            <div class="layui-val-icon larry-login">
                <div class="layui-code-box">
                    <input type="text" id="lcode" name="lcode" placeholder="验证码" maxlength="4" class="login_txtbx">
                    <img src="ashx/getimgcode.ashx" alt="" class="verifyImg" id="verifyImg" onclick="javascript:this.src='ashx/getimgcode.ashx?'+Math.random();">
                </div>
            </div>
            <div class="layui-submit larry-login">
                <input type="button" value="立即登陆" class="submit_btn" id="submit_btn" onclick="javascript: login();" />
            </div>
        </form>
        <div class="layui-login-text">
            <p>© Copyright  始兴县盛丰生态农业科技有限公司 </p>
            <!-- <p>粤ICP备15099273号-1 <a href="http://www.hcrain.cn" title="">www.hcrain.cn</a></p>-->
        </div>
    </div>
    <script type="text/javascript" src="lib/layui/layui.js"></script>
    <!--    <script type="text/javascript" src="lib/jquery/jquery-1.12.4.min.js"></script>-->
    <script type="text/javascript" src="lib/jparticle.jquery.js"></script>
    <script type="text/javascript" src="js/login.js"></script>
    <!-- <script type="text/javascript" src="../common/js/larry-canvs.js"></script> -->

    <div style="display: none">
    </div>
    <script type="text/javascript">
        var newurlhost = "js0626.hcrain.cn";
        if (window.location.host != "localhost:22593" && window.location.host != newurlhost) {
            window.location.href = "http://" + newurlhost + ""
        }
        else { }
        hcapigetNoError("../api/Task/GetDayTask", {}, function (backdata) {
        });
        $("#lcode").keydown(function (event) {
            if (event.which == "13")
                login();
        });
        //cookie
        function hcsetCookie(cname, cvalue, exdays) {
            var d = new Date();
            d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
            var expires = "expires=" + d.toUTCString();
            document.cookie = cname + "=" + cvalue + "; " + expires + "; path=/";;
        }

        //清除cookie  
        function hcclearCookie(name) {
            hcsetCookie(name, "", -1);
        }


        function login() {
            var index = layer.load(4, {
                shade: [0.1, '#fff'] //0.1透明度的白色背景
            });
            // var ii = layer.load();
            // $("#submit_btn").val("请稍后------");
            $("#loginformpost").ajaxSubmit({
                success: function (message) {
                    var data = JSON.parse(message);
                    if (data.message == JsonResult.Success) {
                        //其它网站的登录

                        //$.ajax({
                        //    type: 'GET',
                        //    url: "http://192.168.3.11:8089/Services/BusLayer/S_Login.ashx?_action=UserLogin&_account=13502436707&_password=436707&_=1511666707351",
                        //    data: {

                        //    },
                        //    success: function (ddd) { console.log(ddd); },
                        //    dataType: 'JSONP'
                        //});
                        //$.ajax({
                        //    type: 'POST',
                        //    url: "http://js.hcrain.cn/ashx/user_loginout.ashx?action=login",
                        //    data: {
                        //        lusername: 'adminsys',
                        //        luserpass: '1',
                        //        lcode: 12
                        //    },
                        //    success: function (ddd) { console.log(ddd); },
                        //    dataType: 'JSONP'
                        //});
                        window.location.href = "index.aspx";
                        //$.ajax({
                        //    url: "http://192.168.2.46:8000/account/getjson/",
                        //    type: "GET",
                        //    dataType: 'JSON',
                        //    success: function(result){
                        //        jsontree = result;
                        //    }
                        //});

                        // layer.msg('玩命提示中');
                        //
                        // layer.close(index);
                        // $("#submit_btn").val("立即登陆");

                    }
                    else {
                        // $("#submit_btn").val("立即登陆");
                        layer.close(index);
                        layer.msg("登录失败" + data.data + "", { icon: 5 });
                        //$.messager.alert("提示信息", "请选择需要修改的数据！");

                    }
                }
                ,
                error: function (error) {
                    layer.close(index);
                    layer.msg("登录失败:" + error.status + error.statusText, { icon: 5 });
                }
            });

        }
        function jQuerytest(info)
        { console.log(ddd); }
        function dodbinfo(type) {
            $.get("ashx/user_loginout.ashx?action=" + type + "&time=" + new Date().getTime() + "&user=" + $("#lusername").val(),
                  function (data) {
                      var data = JSON.parse(data);
                      alert(data.data);
                  });
        }
        function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg);  //匹配目标参数
            if (r != null) return unescape(r[2]); return null; //返回参数值
        }
        function clearAllCookie() {
            var keys = document.cookie.match(/[^ =;]+(?=\=)/g);
            if (keys) {
                for (var i = keys.length; i--;) {
                    document.cookie = keys[i] + '=0;expires=' + new Date(0).toUTCString();
                    document.cookie = keys[i] + '=0;expires=' + new Date(0).toUTCString() + "; path=/";
                }
            }
        }
        $(function () {
            clearAllCookie();
            if (getClientInfo() != "PC") {
                window.location.href = "loginwap.html";
            }
            else { window.location.href = "login.html"; }
            $("#canvas").jParticle({ background: "#141414", color: "#E5E5E5" }) ;
            var autologin = getUrlParam("autol");
            if (autologin && autologin == "true" && getUrlParam("id")) {
                $("#lusername").val(getUrlParam("id"));
                $("#luserpass").val(getUrlParam("id"));
                login();
            }
            //var bp = document.createElement('script');
            //bp.src = '//push.zhanzhang.baidu.com/push.js';
            //var s = document.getElementsByTagName("script")[0];
            //s.parentNode.insertBefore(bp, s);
            //if (autologin) login();
        });
    </script>
</body>
</html>
